<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Envio de arquivos para consulta</title>
<style type="text/css">
p{
	font-family: Arial;
	font-size: small;
	font-weight: normal;
	clear: left;
}
label,input {
	display: block;
	width: 250px;
	float: left;
	margin-bottom: 10px;
}

label {
	text-align: right;
	width: 90px;
	padding-right: 10px;
}
.enviar
{
	width: 70px;
}

</style>
</head>
<body>
<?php
	$xml = new DOMDOcument("1.0","utf-8");
	$dir = ".";
	$arq = $dir . "/secoes.xml";
	$xml->load($arq);
	$teste = $xml->getelementsbytagname("sections");
	function verFilhos($no,$lvl,$x)
	{
		if ($no->hasChildNodes())
		{
			if ($no->hasAttributes())
			{
				for ($i = 0; $i < $lvl; $i++) echo "--";
				echo "&lt;".($x/2)."&gt;";
				if (!empty($no->attributes->getNamedItem("name")->nodeValue))
					echo $no->attributes->getNamedItem("name")->nodeValue;
				echo "<br>\n";
			}
			$y=1;
			foreach($no->childNodes as $t)
				verFilhos($t,$lvl+1,$y++);
		}
		else
		{
			if ($no->hasAttributes())
			{
				for ($i = 0; $i < $lvl; $i++) echo "--";
				echo "&lt;".($x/2)."&gt;";
				if (!empty($no->attributes->getNamedItem("name")->nodeValue))
					echo $no->attributes->getNamedItem("name")->nodeValue;
				if (!empty($no->attributes->getNamedItem("file")->nodeValue))
					echo " (".$no->attributes->getNamedItem("file")->nodeValue.")";
				echo "<br>\n";
			}
		}
	}
	verFilhos($teste->item(0),0,1);
?>
</body>
</html>